﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using University.Workshop.Presenters.WaterPurchase;

namespace University.Workshop.Presentation.WaterPurchase
{
    /// <summary>
    /// Interaction logic for PageModifyView.xaml
    /// </summary>
    public partial class PageModifyView : Page, IModifyWaterPurchaseView
    {
        PresenterModifyWaterPurchaseView pModifyWaterPurchaseView;

        public PageModifyView(Model.WaterPurchase wp)
        {
            pModifyWaterPurchaseView = new PresenterModifyWaterPurchaseView(this, wp);
            InitializeComponent();
        }

        private void btnCancelRegister_Click(object sender, RoutedEventArgs e)
        {
            ReturnSearchWaterPurchase();
        }

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            pModifyWaterPurchaseView.GoNextPage();
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            pModifyWaterPurchaseView.GoBackPage();
        }

        private void btnModifyWaterPurchase_Click(object sender, RoutedEventArgs e)
        {
            pModifyWaterPurchaseView.ModifyWaterPurchase();
        }

        private void GoStepTwo_Click(object sender, RoutedEventArgs e)
        {
            pModifyWaterPurchaseView.GoStepTwo();
        }

        private void GoStepOne_Click(object sender, RoutedEventArgs e)
        {
            pModifyWaterPurchaseView.GoStepOne();
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            frmContent.Navigate(new PageFirstStepModifyWaterPurchase(pModifyWaterPurchaseView));
            pModifyWaterPurchaseView.FirstTime();
        }


        #region IModifyWaterPurchaseView Members

        //IRegisterBasicView RegisterBasicValue;

        public void CallSecondPage()
        {
            PageSecondStepModifyWaterPurchase pp = new PageSecondStepModifyWaterPurchase(pModifyWaterPurchaseView);
            ModifyBasic = pp;
            frmContent.NavigationService.Navigate(pp);
            GoStepTwo.IsEnabled = true;
        }

        public void CallFirstPage()
        {
            PageFirstStepModifyWaterPurchase pp = new PageFirstStepModifyWaterPurchase(pModifyWaterPurchaseView);
            ModifyBasic = pp;
            frmContent.NavigationService.Navigate(pp);
        }

        public IModifyBasicView ModifyBasic
        {
            get;
            set;
        }

        public void SystemMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Atencion!!!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }

        public void ErrorMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Error!!!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }

        public void ReturnSearchWaterPurchase()
        {
            this.NavigationService.Navigate(new PageRegisterView());
        }

        #endregion

       
    }
}
